<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

<script>
// 需求：使用prompt输入弹框输入一个邮箱地址，并验证邮箱格式是否正确
var email = prompt('请输入邮箱地址');
// '99835885@qq.com'
// 'zhangsanfeng_123@sohu.com'
// 'wangwu_555@yahoo.com.cn'
var reg = /^\w{6,20}@[0-9a-zA-Z]{1,13}(\.[a-zA-Z]{2,3}){1,2}$/;

if (reg.test(email)) {
    document.write('邮箱格式正确');
} else {
    document.write('邮箱格式错误');
}

</script>
</body>
</html>